<%@page import="java.sql.*"%>
<%@page import="cz.acies.genea.data.persist.*"%>
<%@page import="cz.acies.genea.data.dao.*"%>
<%@page import="org.apache.commons.lang3.time.DateFormatUtils"%>
<%@page import="com.google.gson.Gson"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()	+ path + "/";
String theme = "metro";

Gson gson = new Gson();
String data = "";
try {
	GedPersonDAO dao = new GedPersonDAO();
	String personId ="GE.R.8OPEOF7T18U93QM";
	GedPerson person = new GedPerson(personId);
	person = dao.selectImmediateFamily(person);
	System.out.println(""+person);
	request.setAttribute("person", person);
	/*
	List<GedPerson> records = dao.selectAll();
	List<Map<String, String>> list = new ArrayList<Map<String, String>>();
	for (GedPerson record : records) {
		Map<String, String> row = new LinkedHashMap<String, String>();
		row.put("id", "" + record.getId());
		row.put("displayName", "" + record.getDisplayName());
		String dt = DateFormatUtils.format(record.hasBirthDate() ? record.getBirthDate() : Timestamp.valueOf("2099-01-01 00:00:00"), "dd.MM.yyyy");
		dt = (dt.equals("01.01.2099")) ? "" : dt;
		row.put("birthday", "" + dt);
		//System.out.println(row);
		list.add(row);
	}
	data = "" + gson.toJsonTree(list);
	//System.out.println(""+data);
	 */
} catch (Exception exc) {
	exc.printStackTrace();
}
%>
<!DOCTYPE html">
<html>
<head>
<base href="<%=basePath%>">
<title></title>
<link rel="stylesheet" type="text/css" href="<%=path%>/libs/themes/<%=theme%>/easyui.css">
<link rel="stylesheet" type="text/css" href="<%=path%>/libs/themes/icon.css">
<style type="text/css">
body {
	font-family: sans-serif, Helvetica, Verdana;
	font-size: 11px;
	margin: 0px;
}
.small-card {
	width: 250px; 
	height: 90px;
	padding: 10px;
	border: 1px solid #999;
	margin-bottom: 5px;
}
.large-card { 
	/*width: 520px;*/
	height: 200px;
	padding: 10px;
	border: 1px solid #999;
}
</style>
<script type="text/javascript" src="<%=path%>/libs/jquery-1.9.1.js"></script>
<script type="text/javascript" src="<%=path%>/libs/jquery.easyui.min.js"></script>
<script type="text/javascript" src="<%=path%>/libs/aciea.utils.js"></script>
<script type="text/javascript">
	$(document.body).ready(function() {});
</script>
</head>
<body>
	<table border="0">
		<tr>
			<td rowspan="2">
				<div id="" class="small-card">
					Dytrych Zdeněk
				</div>
			</td>
			<td style="width: 10px;"></td>
			<td style="width: 10px;"></td>
			<td rowspan="2">
				<div class="small-card">
					Dytrychová Eva
				</div>
			</td>
			
		</tr>
		<tr>
			<td style="border-top: 1px solid #999; border-right: 1px solid #999"></td>
			<td style="border-top: 1px solid #999;"></td>
		</tr>
		<tr>
			<td colspan="2" style="border-right: 1px solid #999"></td>
			<td colspan="2"></td>
			<td colspan="1" style="width: 250px; height: 25px;">Sourozenci</td>
		</tr>
		<tr>
			<td colspan="4" style="vertical-align: top;">
				<div id="${person.id}" class="large-card">
					${person.firstName}&nbsp;${person.lastName}
				</div>
			</td>
			<td colspan="1" style="vertical-align: top;">
				<div>
					<div class="small-card">Misiloová Ivana</div>
					<div class="small-card">Dytrychová Zdeněk</div>
					<div class="small-card">Dytrychová 1</div>
					<div class="small-card">Dytrychová 2</div>
				</div>
			</td>
		</tr>		
		<tr>
			<td colspan="2">Partneři</td>
			<td style="width: 10px;"></td>
			<td colspan="1">Děti</td>
		</tr>
		<tr>
			<td colspan="2" style="vertical-align: top;">
				<div class="small-card">
					Dytrycová Milena
				</div>
			</td>
			<td style="width: 10px;"></td>
			<td colspan="1">
				<div style="vertical-align: top;">
					<div class="small-card">Dytrycová Adela</div>
					<div class="small-card">Dytrycová Tereza</div>
				</div>
			</td>
		</tr>		
		<tr>
			<td colspan="2">
				<div  class="small-card">
					Dytrycová Jitka
				</div>
			</td>
			<td style="width: 10px;"></td>
			<td colspan="2">
				<div style="vertical-align: top;">
				</div>
			</td>
		</tr>		
	</table>
</body>
</html>
